﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;

namespace BZZ.Web.ctrl
{
    public partial class ctrFriendLink : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            showInfoList();

        }

        #region 信息列表和查询

        /// <summary>
        /// 数据列表
        /// </summary>
        protected void showInfoList()
        {
            #region 变量定义
            DataSet dset = new DataSet();
            BZZ.DAL.links dal = new BZZ.DAL.links();
            System.Collections.Generic.List<System.Data.SqlClient.SqlParameter> paraList = new List<System.Data.SqlClient.SqlParameter>();
            string dataFields = ""; //读取的字段名，空为所有
            string strWhere = "1=1"; //查询子句
            string strOrderBy = " id desc"; //排序参数，如果需要分页，则必填 
            #endregion

            #region 查询条件
            //string strId = txtQryId.Text.Trim();
            //if (strId != "" && strId != null )
            //{
            //    strWhere += " and id=@id";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@id", strId));
            //} 
            //string strLinkName = txtQryLinkName.Text.Trim();
            //if (strLinkName != null && strLinkName != "")
            //{
            //    strWhere += " and linkName=@linkName";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@linkName", strLinkName));
            //}
            //string strGotoUrl = txtQryGotoUrl.Text.Trim();
            //if (strGotoUrl != null && strGotoUrl != "")
            //{
            //    strWhere += " and gotoUrl=@gotoUrl";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@gotoUrl", strGotoUrl));
            //}
            //string strTitle = txtQryTitle.Text.Trim();
            //if (strTitle != "" && strTitle != null )
            //{
            //    strWhere += " and title=@title";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@title", strTitle));
            //} 
            //string strAbout = txtQryAbout.Text.Trim();
            //if (strAbout != "" && strAbout != null )
            //{
            //    strWhere += " and about=@about";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@about", strAbout));
            //} 
            //string strUpdateDate = txtQryUpdateDate.Text.Trim();
            //if (strUpdateDate != "" && strUpdateDate != null )
            //{
            //    strWhere += " and updateDate=@updateDate";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@updateDate", strUpdateDate));
            //} 
            //string strStatus ="1";
            //if (strStatus != "" && strStatus != null)
            //{
            //    strWhere += " and status=@status";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@status", strStatus));
            //} 
            //string strExt = txtQryExt.Text.Trim();
            //if (strExt != "" && strExt != null )
            //{
            //    strWhere += " and ext=@ext";
            //    paraList.Add(new System.Data.SqlClient.SqlParameter("@ext", strExt));
            //} 
            #endregion

            #region 分页控件绑定
            int pageSize = 30; //分页每页记录个数
            int totalRecourd = 0; //总记录个数
            int currentPage = 1; //当前页码
           

            totalRecourd = dal.GetCount(strWhere, paraList);
            dset = dal.GetDataset("");
            if (dset != null && dset.Tables[0].Rows.Count > 0)
            {
                rptFriendLink.DataSource = dset;
                rptFriendLink.DataBind();
            }
            
            #endregion
            #region 单页数据绑定
            //strWhere += " " + strOrderBy;
            //dset = dal.GetDataset(strWhere, paraList, dataFields);
            //if (dset.Tables[0].Rows.Count > 0)
            //{
            //    rptInfoList.DataSource = dset;
            //    rptInfoList.DataBind();
            //}
            //else
            //{
            //    litPromptMessage.Text = "没有查询到相关记录";
            //} 
            #endregion

        }
        #endregion

    }
}